package com.example.module_hp_white_noise.adapter;

import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;

import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.module_hp_white_noise.R;
import com.example.module_hp_white_noise.entity.HpWhiteNoiseEntity1;

public class HpWhiteNoisePage1Chunk2Adapter extends BaseQuickAdapter<HpWhiteNoiseEntity1, BaseViewHolder> {
    public HpWhiteNoisePage1Chunk2Adapter() {
        super(R.layout.item_hp_white_noise_page1_chunk2);
    }
    @Override
    protected void convert(BaseViewHolder helper, HpWhiteNoiseEntity1 item) {
        helper.setText(R.id.item_title,item.getTitle());
        helper.setText(R.id.item_describe,item.getDescribe());
        ImageView view = helper.getView(R.id.item_img);
        //设置图片等高
        int imgUrl = view.getContext().getResources().getIdentifier(item.getImgUrl(),"drawable",view.getContext().getPackageName());
        //Log.e("资源id", String.valueOf(imgUrl));
        Glide.with(view.getContext()).load(imgUrl).apply(new RequestOptions().centerCrop().bitmapTransform(new RoundedCorners(140))).into(view);
    }
}
